<?php


abstract class BaseFunmNino extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $genr_fundacion_id;


	
	protected $funm_nino_id;


	
	protected $funnin_cedula;


	
	protected $funnin_nombre;


	
	protected $funnin_apellido;


	
	protected $funnin_lugarnacimiento = 'null';


	
	protected $funnin_fechanacimiento;


	
	protected $funnin_foto;


	
	protected $funnin_sexo;


	
	protected $funnin_direccion;


	
	protected $funnin_vivienda;


	
	protected $funnin_estado;


	
	protected $funnin_observacion;

	
	protected $aGenrFundacion;

	
	protected $collFuntCasos;

	
	protected $lastFuntCasoCriteria = null;

	
	protected $collFuntNinosxcasos;

	
	protected $lastFuntNinosxcasoCriteria = null;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getGenrFundacionId()
	{

		return $this->genr_fundacion_id;
	}

	
	public function getFunmNinoId()
	{

		return $this->funm_nino_id;
	}

	
	public function getFunninCedula()
	{

		return $this->funnin_cedula;
	}

	
	public function getFunninNombre()
	{

		return $this->funnin_nombre;
	}

	
	public function getFunninApellido()
	{

		return $this->funnin_apellido;
	}

	
	public function getFunninLugarnacimiento()
	{

		return $this->funnin_lugarnacimiento;
	}

	
	public function getFunninFechanacimiento($format = 'Y-m-d')
	{

		if ($this->funnin_fechanacimiento === null || $this->funnin_fechanacimiento === '') {
			return null;
		} elseif (!is_int($this->funnin_fechanacimiento)) {
						$ts = strtotime($this->funnin_fechanacimiento);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [funnin_fechanacimiento] as date/time value: " . var_export($this->funnin_fechanacimiento, true));
			}
		} else {
			$ts = $this->funnin_fechanacimiento;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getFunninFoto()
	{

		return $this->funnin_foto;
	}

	
	public function getFunninSexo()
	{

		return $this->funnin_sexo;
	}

	
	public function getFunninDireccion()
	{

		return $this->funnin_direccion;
	}

	
	public function getFunninVivienda()
	{

		return $this->funnin_vivienda;
	}

	
	public function getFunninEstado()
	{

		return $this->funnin_estado;
	}

	
	public function getFunninObservacion()
	{

		return $this->funnin_observacion;
	}

	
	public function setGenrFundacionId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->genr_fundacion_id !== $v) {
			$this->genr_fundacion_id = $v;
			$this->modifiedColumns[] = FunmNinoPeer::GENR_FUNDACION_ID;
		}

		if ($this->aGenrFundacion !== null && $this->aGenrFundacion->getGenrFundacionId() !== $v) {
			$this->aGenrFundacion = null;
		}

	} 
	
	public function setFunmNinoId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->funm_nino_id !== $v) {
			$this->funm_nino_id = $v;
			$this->modifiedColumns[] = FunmNinoPeer::FUNM_NINO_ID;
		}

	} 
	
	public function setFunninCedula($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->funnin_cedula !== $v) {
			$this->funnin_cedula = $v;
			$this->modifiedColumns[] = FunmNinoPeer::FUNNIN_CEDULA;
		}

	} 
	
	public function setFunninNombre($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->funnin_nombre !== $v) {
			$this->funnin_nombre = $v;
			$this->modifiedColumns[] = FunmNinoPeer::FUNNIN_NOMBRE;
		}

	} 
	
	public function setFunninApellido($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->funnin_apellido !== $v) {
			$this->funnin_apellido = $v;
			$this->modifiedColumns[] = FunmNinoPeer::FUNNIN_APELLIDO;
		}

	} 
	
	public function setFunninLugarnacimiento($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->funnin_lugarnacimiento !== $v || $v === 'null') {
			$this->funnin_lugarnacimiento = $v;
			$this->modifiedColumns[] = FunmNinoPeer::FUNNIN_LUGARNACIMIENTO;
		}

	} 
	
	public function setFunninFechanacimiento($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [funnin_fechanacimiento] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->funnin_fechanacimiento !== $ts) {
			$this->funnin_fechanacimiento = $ts;
			$this->modifiedColumns[] = FunmNinoPeer::FUNNIN_FECHANACIMIENTO;
		}

	} 
	
	public function setFunninFoto($v)
	{

								if ($v instanceof Lob && $v === $this->funnin_foto) {
			$changed = $v->isModified();
		} else {
			$changed = ($this->funnin_foto !== $v);
		}
		if ($changed) {
			if ( !($v instanceof Lob) ) {
				$obj = new Clob();
				$obj->setContents($v);
			} else {
				$obj = $v;
			}
			$this->funnin_foto = $obj;
			$this->modifiedColumns[] = FunmNinoPeer::FUNNIN_FOTO;
		}

	} 
	
	public function setFunninSexo($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->funnin_sexo !== $v) {
			$this->funnin_sexo = $v;
			$this->modifiedColumns[] = FunmNinoPeer::FUNNIN_SEXO;
		}

	} 
	
	public function setFunninDireccion($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->funnin_direccion !== $v) {
			$this->funnin_direccion = $v;
			$this->modifiedColumns[] = FunmNinoPeer::FUNNIN_DIRECCION;
		}

	} 
	
	public function setFunninVivienda($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->funnin_vivienda !== $v) {
			$this->funnin_vivienda = $v;
			$this->modifiedColumns[] = FunmNinoPeer::FUNNIN_VIVIENDA;
		}

	} 
	
	public function setFunninEstado($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->funnin_estado !== $v) {
			$this->funnin_estado = $v;
			$this->modifiedColumns[] = FunmNinoPeer::FUNNIN_ESTADO;
		}

	} 
	
	public function setFunninObservacion($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->funnin_observacion !== $v) {
			$this->funnin_observacion = $v;
			$this->modifiedColumns[] = FunmNinoPeer::FUNNIN_OBSERVACION;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->genr_fundacion_id = $rs->getInt($startcol + 0);

			$this->funm_nino_id = $rs->getInt($startcol + 1);

			$this->funnin_cedula = $rs->getString($startcol + 2);

			$this->funnin_nombre = $rs->getString($startcol + 3);

			$this->funnin_apellido = $rs->getString($startcol + 4);

			$this->funnin_lugarnacimiento = $rs->getString($startcol + 5);

			$this->funnin_fechanacimiento = $rs->getDate($startcol + 6, null);

			$this->funnin_foto = $rs->getBlob($startcol + 7);

			$this->funnin_sexo = $rs->getString($startcol + 8);

			$this->funnin_direccion = $rs->getString($startcol + 9);

			$this->funnin_vivienda = $rs->getString($startcol + 10);

			$this->funnin_estado = $rs->getString($startcol + 11);

			$this->funnin_observacion = $rs->getString($startcol + 12);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 13; 
		} catch (Exception $e) {
			throw new PropelException("Error populating FunmNino object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(FunmNinoPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			FunmNinoPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(FunmNinoPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


												
			if ($this->aGenrFundacion !== null) {
				if ($this->aGenrFundacion->isModified()) {
					$affectedRows += $this->aGenrFundacion->save($con);
				}
				$this->setGenrFundacion($this->aGenrFundacion);
			}


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = FunmNinoPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setFunmNinoId($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += FunmNinoPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			if ($this->collFuntCasos !== null) {
				foreach($this->collFuntCasos as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collFuntNinosxcasos !== null) {
				foreach($this->collFuntNinosxcasos as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


												
			if ($this->aGenrFundacion !== null) {
				if (!$this->aGenrFundacion->validate($columns)) {
					$failureMap = array_merge($failureMap, $this->aGenrFundacion->getValidationFailures());
				}
			}


			if (($retval = FunmNinoPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->collFuntCasos !== null) {
					foreach($this->collFuntCasos as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collFuntNinosxcasos !== null) {
					foreach($this->collFuntNinosxcasos as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = FunmNinoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getGenrFundacionId();
				break;
			case 1:
				return $this->getFunmNinoId();
				break;
			case 2:
				return $this->getFunninCedula();
				break;
			case 3:
				return $this->getFunninNombre();
				break;
			case 4:
				return $this->getFunninApellido();
				break;
			case 5:
				return $this->getFunninLugarnacimiento();
				break;
			case 6:
				return $this->getFunninFechanacimiento();
				break;
			case 7:
				return $this->getFunninFoto();
				break;
			case 8:
				return $this->getFunninSexo();
				break;
			case 9:
				return $this->getFunninDireccion();
				break;
			case 10:
				return $this->getFunninVivienda();
				break;
			case 11:
				return $this->getFunninEstado();
				break;
			case 12:
				return $this->getFunninObservacion();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = FunmNinoPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getGenrFundacionId(),
			$keys[1] => $this->getFunmNinoId(),
			$keys[2] => $this->getFunninCedula(),
			$keys[3] => $this->getFunninNombre(),
			$keys[4] => $this->getFunninApellido(),
			$keys[5] => $this->getFunninLugarnacimiento(),
			$keys[6] => $this->getFunninFechanacimiento(),
			$keys[7] => $this->getFunninFoto(),
			$keys[8] => $this->getFunninSexo(),
			$keys[9] => $this->getFunninDireccion(),
			$keys[10] => $this->getFunninVivienda(),
			$keys[11] => $this->getFunninEstado(),
			$keys[12] => $this->getFunninObservacion(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = FunmNinoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setGenrFundacionId($value);
				break;
			case 1:
				$this->setFunmNinoId($value);
				break;
			case 2:
				$this->setFunninCedula($value);
				break;
			case 3:
				$this->setFunninNombre($value);
				break;
			case 4:
				$this->setFunninApellido($value);
				break;
			case 5:
				$this->setFunninLugarnacimiento($value);
				break;
			case 6:
				$this->setFunninFechanacimiento($value);
				break;
			case 7:
				$this->setFunninFoto($value);
				break;
			case 8:
				$this->setFunninSexo($value);
				break;
			case 9:
				$this->setFunninDireccion($value);
				break;
			case 10:
				$this->setFunninVivienda($value);
				break;
			case 11:
				$this->setFunninEstado($value);
				break;
			case 12:
				$this->setFunninObservacion($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = FunmNinoPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setGenrFundacionId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setFunmNinoId($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setFunninCedula($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setFunninNombre($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setFunninApellido($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setFunninLugarnacimiento($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setFunninFechanacimiento($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setFunninFoto($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setFunninSexo($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setFunninDireccion($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setFunninVivienda($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setFunninEstado($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setFunninObservacion($arr[$keys[12]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(FunmNinoPeer::DATABASE_NAME);

		if ($this->isColumnModified(FunmNinoPeer::GENR_FUNDACION_ID)) $criteria->add(FunmNinoPeer::GENR_FUNDACION_ID, $this->genr_fundacion_id);
		if ($this->isColumnModified(FunmNinoPeer::FUNM_NINO_ID)) $criteria->add(FunmNinoPeer::FUNM_NINO_ID, $this->funm_nino_id);
		if ($this->isColumnModified(FunmNinoPeer::FUNNIN_CEDULA)) $criteria->add(FunmNinoPeer::FUNNIN_CEDULA, $this->funnin_cedula);
		if ($this->isColumnModified(FunmNinoPeer::FUNNIN_NOMBRE)) $criteria->add(FunmNinoPeer::FUNNIN_NOMBRE, $this->funnin_nombre);
		if ($this->isColumnModified(FunmNinoPeer::FUNNIN_APELLIDO)) $criteria->add(FunmNinoPeer::FUNNIN_APELLIDO, $this->funnin_apellido);
		if ($this->isColumnModified(FunmNinoPeer::FUNNIN_LUGARNACIMIENTO)) $criteria->add(FunmNinoPeer::FUNNIN_LUGARNACIMIENTO, $this->funnin_lugarnacimiento);
		if ($this->isColumnModified(FunmNinoPeer::FUNNIN_FECHANACIMIENTO)) $criteria->add(FunmNinoPeer::FUNNIN_FECHANACIMIENTO, $this->funnin_fechanacimiento);
		if ($this->isColumnModified(FunmNinoPeer::FUNNIN_FOTO)) $criteria->add(FunmNinoPeer::FUNNIN_FOTO, $this->funnin_foto);
		if ($this->isColumnModified(FunmNinoPeer::FUNNIN_SEXO)) $criteria->add(FunmNinoPeer::FUNNIN_SEXO, $this->funnin_sexo);
		if ($this->isColumnModified(FunmNinoPeer::FUNNIN_DIRECCION)) $criteria->add(FunmNinoPeer::FUNNIN_DIRECCION, $this->funnin_direccion);
		if ($this->isColumnModified(FunmNinoPeer::FUNNIN_VIVIENDA)) $criteria->add(FunmNinoPeer::FUNNIN_VIVIENDA, $this->funnin_vivienda);
		if ($this->isColumnModified(FunmNinoPeer::FUNNIN_ESTADO)) $criteria->add(FunmNinoPeer::FUNNIN_ESTADO, $this->funnin_estado);
		if ($this->isColumnModified(FunmNinoPeer::FUNNIN_OBSERVACION)) $criteria->add(FunmNinoPeer::FUNNIN_OBSERVACION, $this->funnin_observacion);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(FunmNinoPeer::DATABASE_NAME);

		$criteria->add(FunmNinoPeer::GENR_FUNDACION_ID, $this->genr_fundacion_id);
		$criteria->add(FunmNinoPeer::FUNM_NINO_ID, $this->funm_nino_id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		$pks = array();

		$pks[0] = $this->getGenrFundacionId();

		$pks[1] = $this->getFunmNinoId();

		return $pks;
	}

	
	public function setPrimaryKey($keys)
	{

		$this->setGenrFundacionId($keys[0]);

		$this->setFunmNinoId($keys[1]);

	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setFunninCedula($this->funnin_cedula);

		$copyObj->setFunninNombre($this->funnin_nombre);

		$copyObj->setFunninApellido($this->funnin_apellido);

		$copyObj->setFunninLugarnacimiento($this->funnin_lugarnacimiento);

		$copyObj->setFunninFechanacimiento($this->funnin_fechanacimiento);

		$copyObj->setFunninFoto($this->funnin_foto);

		$copyObj->setFunninSexo($this->funnin_sexo);

		$copyObj->setFunninDireccion($this->funnin_direccion);

		$copyObj->setFunninVivienda($this->funnin_vivienda);

		$copyObj->setFunninEstado($this->funnin_estado);

		$copyObj->setFunninObservacion($this->funnin_observacion);


		if ($deepCopy) {
									$copyObj->setNew(false);

			foreach($this->getFuntCasos() as $relObj) {
				$copyObj->addFuntCaso($relObj->copy($deepCopy));
			}

			foreach($this->getFuntNinosxcasos() as $relObj) {
				$copyObj->addFuntNinosxcaso($relObj->copy($deepCopy));
			}

		} 

		$copyObj->setNew(true);

		$copyObj->setGenrFundacionId(NULL); 
		$copyObj->setFunmNinoId(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new FunmNinoPeer();
		}
		return self::$peer;
	}

	
	public function setGenrFundacion($v)
	{


		if ($v === null) {
			$this->setGenrFundacionId(NULL);
		} else {
			$this->setGenrFundacionId($v->getGenrFundacionId());
		}


		$this->aGenrFundacion = $v;
	}


	
	public function getGenrFundacion($con = null)
	{
		if ($this->aGenrFundacion === null && ($this->genr_fundacion_id !== null)) {
						include_once 'lib/model/om/BaseGenrFundacionPeer.php';

			$this->aGenrFundacion = GenrFundacionPeer::retrieveByPK($this->genr_fundacion_id, $con);

			
		}
		return $this->aGenrFundacion;
	}

	
	public function initFuntCasos()
	{
		if ($this->collFuntCasos === null) {
			$this->collFuntCasos = array();
		}
	}

	
	public function getFuntCasos($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseFuntCasoPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collFuntCasos === null) {
			if ($this->isNew()) {
			   $this->collFuntCasos = array();
			} else {

				$criteria->add(FuntCasoPeer::FUNM_NINO_ID, $this->getFunmNinoId());

				FuntCasoPeer::addSelectColumns($criteria);
				$this->collFuntCasos = FuntCasoPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(FuntCasoPeer::FUNM_NINO_ID, $this->getFunmNinoId());

				FuntCasoPeer::addSelectColumns($criteria);
				if (!isset($this->lastFuntCasoCriteria) || !$this->lastFuntCasoCriteria->equals($criteria)) {
					$this->collFuntCasos = FuntCasoPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastFuntCasoCriteria = $criteria;
		return $this->collFuntCasos;
	}

	
	public function countFuntCasos($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseFuntCasoPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(FuntCasoPeer::FUNM_NINO_ID, $this->getFunmNinoId());

		return FuntCasoPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addFuntCaso(FuntCaso $l)
	{
		$this->collFuntCasos[] = $l;
		$l->setFunmNino($this);
	}

	
	public function initFuntNinosxcasos()
	{
		if ($this->collFuntNinosxcasos === null) {
			$this->collFuntNinosxcasos = array();
		}
	}

	
	public function getFuntNinosxcasos($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseFuntNinosxcasoPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collFuntNinosxcasos === null) {
			if ($this->isNew()) {
			   $this->collFuntNinosxcasos = array();
			} else {

				$criteria->add(FuntNinosxcasoPeer::FUNM_NINO_ID, $this->getFunmNinoId());

				FuntNinosxcasoPeer::addSelectColumns($criteria);
				$this->collFuntNinosxcasos = FuntNinosxcasoPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(FuntNinosxcasoPeer::FUNM_NINO_ID, $this->getFunmNinoId());

				FuntNinosxcasoPeer::addSelectColumns($criteria);
				if (!isset($this->lastFuntNinosxcasoCriteria) || !$this->lastFuntNinosxcasoCriteria->equals($criteria)) {
					$this->collFuntNinosxcasos = FuntNinosxcasoPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastFuntNinosxcasoCriteria = $criteria;
		return $this->collFuntNinosxcasos;
	}

	
	public function countFuntNinosxcasos($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseFuntNinosxcasoPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(FuntNinosxcasoPeer::FUNM_NINO_ID, $this->getFunmNinoId());

		return FuntNinosxcasoPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addFuntNinosxcaso(FuntNinosxcaso $l)
	{
		$this->collFuntNinosxcasos[] = $l;
		$l->setFunmNino($this);
	}


	
	public function getFuntNinosxcasosJoinFuntCaso($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseFuntNinosxcasoPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collFuntNinosxcasos === null) {
			if ($this->isNew()) {
				$this->collFuntNinosxcasos = array();
			} else {

				$criteria->add(FuntNinosxcasoPeer::FUNM_NINO_ID, $this->getFunmNinoId());

				$this->collFuntNinosxcasos = FuntNinosxcasoPeer::doSelectJoinFuntCaso($criteria, $con);
			}
		} else {
									
			$criteria->add(FuntNinosxcasoPeer::FUNM_NINO_ID, $this->getFunmNinoId());

			if (!isset($this->lastFuntNinosxcasoCriteria) || !$this->lastFuntNinosxcasoCriteria->equals($criteria)) {
				$this->collFuntNinosxcasos = FuntNinosxcasoPeer::doSelectJoinFuntCaso($criteria, $con);
			}
		}
		$this->lastFuntNinosxcasoCriteria = $criteria;

		return $this->collFuntNinosxcasos;
	}

} 